package org.point.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegularImgUtil {
	public static String getRegularImg(String article){
		String regEx_img = "<img.*src\\s*=\\s*(.*?)[^>]*?>"; 
	    String img="";
	    String regularImg="/images/news_default.jpg";
	    Pattern p_image=Pattern.compile(regEx_img,Pattern.CASE_INSENSITIVE);
	    Matcher m_image = p_image.matcher(article);
	    while(m_image.find()){   
            img = img + "," + m_image.group();   
           // Matcher m  = Pattern.compile("src=\"?(.*?)(\"|>|\\s+)").matcher(img); //ƥ��src

           Matcher m  = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(img);

            while(m.find()){
            	System.out.println(m.group(1));
            	regularImg=m.group(1);
            	break;
            }
        }   
	    return regularImg;
	}
}
